<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>

    <div id="root">
        <div>
            获取Vue实例中的方法：
            <div>带括号：{{test1()}}</div>
            <div>不带括号：{{test1}}</div>
        </div>

        <br>

        <div>
            姓<input type="text" v-model="firstName"><br>
            名<input type="text" v-model="lastName"><br>
            全名：{{fullName()}}
        </div>

    </div>

</body>

<script type="text/javascript">
    const vm = new Vue({
        el: '#root',
        data: {
            firstName: '张',
            lastName: '三'
        },
        methods: {
            test1() {
                return '这是test1方法的返回值'
            },
            fullName() {
                return this.firstName.slice(0,4) + '-' + this.lastName;
            }
        }
    });

    Vue.config.productionTip = false  //阻止 vue 在启动时生成生产提示。
</script>

</html>